package com.wangsd.web.face.entity;

import com.baomidou.mybatisplus.annotation.*;
import com.fasterxml.jackson.annotation.JsonFormat;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;

@Data
@Entity
@Table(name = "member_level")
@ApiModel(value = "会员等级", description = "会员等级")
public class MemberLevel implements Serializable {

    @ApiModelProperty(value = "商户id")
    private Long merchantId;
    @ApiModelProperty(value = "会员卡名称")
    private String cardName;
    @ApiModelProperty(value = "会员折扣")
    @Column(name = "discount", columnDefinition = "double(3,2) default 1 not null")
    private Double discount;
    @ApiModelProperty(value = "单次充值多少达标")
    @Column(name = "once_fee", columnDefinition = "int(20) default 0 not null")
    private Long onceFee;
    @ApiModelProperty(value = "是否注册默认等级")
    @Column(name = "is_default", columnDefinition = "int(1) default 1 not null")
    private Integer isDefault;

    /**
     * 以下是通用字段
     */
    @Id
    @TableId(type = IdType.AUTO)
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    private Long id;

    @ApiModelProperty(value = "创建时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT)
    private Date createdTime;

    @ApiModelProperty(value = "修改时间")
    @JsonFormat(pattern = "yyyy-MM-dd HH:mm:ss")
    @TableField(fill = FieldFill.INSERT_UPDATE)
    private Date updatedTime;

    @TableLogic
    @TableField(fill = FieldFill.INSERT)
    private Integer deleted;

    @ApiModelProperty(value = "检索标识")
    private String code;

    @ApiModelProperty(value = "商户名称")
    @Transient
    @TableField(exist = false)
    private String merchantName;
}
